/*
 * @Author: lsjweiyi 759209794@qq.com
 * @Date: 2024-02-01 22:03:16
 * @LastEditors: lsjweiyi 759209794@qq.com
 * @LastEditTime: 2024-02-01 22:05:07
 * @FilePath: \random-drawing2\app.go
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package main

import (
	"context"
	"fmt"

	"github.com/wailsapp/wails/v2/pkg/runtime"
)

// App struct
type App struct {
	ctx context.Context
}

// NewApp creates a new App application struct
func NewApp() *App {
	return &App{}
}

// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
	a.ctx = ctx
}

// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
	return fmt.Sprintf("Hello %s, It's show time!", name)
}

func (a *App) GetCompanies() Icompanies {
	return GetCompanies()
}


func (a *App) OpenDialog(msg string){
	runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
        Type:          runtime.QuestionDialog,
        Title:         "恭喜！",
        Message:       msg,
        DefaultButton: "No",
    })
}